﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System;

namespace CLFramework.Infrastructure
{
    public class PagedResult<T> : List<T>, IPagedResult
    {
        public PagedResult(IEnumerable<T> items, int pageIndex, int pageSize, int totalItemCount)
        {
            AddRange(items);
            PageIndex = pageIndex;
            PageSize = pageSize;
            TotalItemCount = totalItemCount;
            TotalPageCount = (int)Math.Ceiling(totalItemCount / (double)pageSize);        
        }

        public int PageIndex { get; private set; }
        public int PageSize { get; private set; }
        public int TotalItemCount { get; private set; }
        public int TotalPageCount { get; private set; }
    }
}
